﻿CREATE FUNCTION [dbo].[getPUInvSumCur]
	(
	@PUId int
	)
RETURNS money
AS
	BEGIN

	DECLARE @invSum money

	SELECT @invSum = SUM(dbo.INVOICE_OUT_ITEM.SUM) from INVOICE_OUT_ITEM WHERE PRODUCT_UNIT_ID=@PUId

	RETURN ISNULL(@invSum,0)
	END